package com.fesine.blog.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @description: 用户主页控制器
 * @author: Fesine
 * @createTime:2017/12/17
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2017/12/17
 */
@Controller
@RequestMapping("/u")
public class UserSpaceController {


    private static final Logger logger = LoggerFactory.getLogger(UserSpaceController.class);

    @GetMapping("/{username}")
    public String userSpace(@PathVariable String username){
        return "/userspace/u";
    }

    @GetMapping("/{username}/blogs")
    public String listBlogsByOrder(@PathVariable String username,
            @RequestParam(value = "order", required = false, defaultValue = "new") String order,
                            @RequestParam(value = "catagory", required = false) String catagory,
                            @RequestParam(value = "keyword", required = false) Long keyword
    ) {
        return "/userspace/u";
    }

    @GetMapping("/{username}/blogs/{id}")
    public String viewBlog(@PathVariable String username,@PathVariable Long id){
        return "userspace/blog";
    }
    @GetMapping("/{username}/blogs/edit")
    public String editBlog(@PathVariable String username){
        return "userspace/blogedit";
    }

}
